Security News
Combatting Alert Fatigue by Prioritizing Malicious Intent
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
@jest/expect-utils
Advanced tools
This module exports some utils for the `expect` function used in [Jest](https://jestjs.io/).
@jest/expect-utils is a utility package for Jest that provides additional matchers and utilities to enhance the testing experience. It is designed to work seamlessly with Jest's built-in expect function, allowing for more expressive and readable test assertions.
toBeArray
Checks if the value is an array.
expect([1, 2, 3]).toBeArray();
toBeObject
Checks if the value is an object.
expect({ key: 'value' }).toBeObject();
toBeEmpty
Checks if the value is empty. This can be used for arrays, objects, or strings.
expect([]).toBeEmpty();
toContainKey
Checks if the object contains the specified key.
expect({ key: 'value' }).toContainKey('key');
toContainValue
Checks if the object contains the specified value.
expect({ key: 'value' }).toContainValue('value');
jest-extended provides a large number of additional matchers for Jest. It offers a wide range of matchers similar to @jest/expect-utils, such as toBeArray, toBeObject, and toBeEmpty, but also includes many more specialized matchers.
Chai is an assertion library for Node.js and the browser that can be paired with any testing framework. It provides a rich set of matchers and is highly extensible. While it is not specifically designed for Jest, it offers similar functionalities through its expect/should interfaces.
expect-more is a set of additional matchers for Jest and Jasmine. It provides a variety of matchers for different data types and use cases, similar to @jest/expect-utils, and aims to make tests more expressive and readable.
@jest/expect-utils
This module exports some utils for the expect
function used in Jest.
You probably don't want to use this package directly. E.g. if you're writing custom matcher, you should use the injected this.equals
.
28.1.3
[jest-leak-detector]
Use native FinalizationRegistry
when it exists to get rid of external C dependency (#12973)[jest-changed-files]
Fix a lock-up after repeated invocations (#12757)[@jest/expect-utils]
Fix deep equality of ImmutableJS OrderedSets (#12977)[jest-mock]
Add index signature support for spyOn
types (#13013, #13020)[jest-snapshot]
Fix indentation of awaited inline snapshots (#12986)FAQs
This module exports some utils for the `expect` function used in [Jest](https://jestjs.io/).
The npm package @jest/expect-utils receives a total of 12,463,658 weekly downloads. As such, @jest/expect-utils popularity was classified as popular.
We found that @jest/expect-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.